@extends('mobile_end.layouts.default')
{{-- content_header --}}

@section('container')
<div id="slider" xmlns="http://www.w3.org/1999/html">
    @if($entry->thumbs->count()>0)
    @foreach($entry->thumbs as $thumb)
    <img src="{{ URL::to('file/image_crop/4/3/0?name='). $thumb->path }}">
    @endforeach
    @else
    <img src="{{ URL::to('file/image_crop/4/3/0?name=').'default_food.jpg' }}">
    @endif
</div>
<div class="ui-navigator">
    <div class="carttop"><i class="icon-picture icon-2x"></i>{{$entry->name}}</div>
</div>
<!-- 商品信息 -->
{{ Form::open(array('action' => array('MobileBasketController@addFood'))) }}
<ul class="detail-list">
    <li><h1>单价： ￥ {{$entry->price}} 元 </h1></li>
    <li><h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{$entry->description}}</h1></li>
    <li> 更新时间: {{ $entry->updated_at }}</li>
    <input type="hidden" name="id" value="{{ $entry->id }}"/>
    <li>
        <span class="button-wrap">
            <a href="#" class="button button-pill button-royal button-tiny"><i class="icon-minus"></i></a>
            <input class="cartqty" type="text" name="count" value="1"/>&nbsp;&nbsp;
            <a href="#" class="button button-pill button-royal button-tiny"><i class="icon-plus"></i></a>
        </span>
    </li>
    <li>
        <span class="button-wrap">
            <button type="submit" class="button button-pill button-action">加入菜单</button> &nbsp;&nbsp;
            <a onclick="window.history.go(-1)" class="button button-pill button-primary"><i class="icon-reply"></i> 返回</a>
        </span>
    </li>
</ul>
{{ Form::close() }}
<!-- 商品信息 END -->
@stop


@section('scripts')

    <script>
        //创建slider组件
        $('#slider').slider( { imgZoom: true });

        $('.icon-minus').parent().on('click', function(){
            var count = parseInt($('input[name="count"]').val());
            if(count <= 1) count = 2;
            $('input[name="count"]').val(count - 1);
        });

        $('.icon-plus').parent().on('click', function(){
            var count = parseInt($('input[name="count"]').val());
            $('input[name="count"]').val(count + 1);
        });
    </script>

@stop